package com.study.SpringBootLesson4.springboot.listener;

import javax.servlet.ServletContext;
import javax.servlet.ServletRequestEvent;
import javax.servlet.ServletRequestListener;
import javax.servlet.annotation.WebListener;
import javax.servlet.http.HttpServletRequest;

/**
 * @author 赵超
 * @Description springbootApi注解注册监听器
 * @create 2017-11-29 11:14
 **/
public class MyServletRequestListener2 implements ServletRequestListener {
    @Override
    public void requestInitialized(ServletRequestEvent servletRequestEvent) {

        HttpServletRequest request = (HttpServletRequest) servletRequestEvent.getServletRequest();
        ServletContext servletContext = request.getServletContext();
        servletContext.log("request2 was initialized !");

    }

    @Override
    public void requestDestroyed(ServletRequestEvent servletRequestEvent) {

        HttpServletRequest request = (HttpServletRequest) servletRequestEvent.getServletRequest();
        ServletContext servletContext = request.getServletContext();
        servletContext.log("request2 was destroyed !");

    }
}
